# -*- encoding: utf-8 -*-
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.views.generic.simple import redirect_to

admin.autodiscover()

from noticia.models import Noticia

urlpatterns = patterns('',
    # Example:
    # (r'^portal/', include('portal.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/filebrowser/', include('filebrowser.urls')),
    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),
    #CHAMANDO O GRAPPELLI ÁRA USO
    (r'^grappelli/', include('grappelli.urls')),

    (r'^cordec/$', 'principal.views.principal'),
    url(r'^$', 'principal.views.principal', name='principal'),

)

#para app noticia
urlpatterns += patterns('noticia.views',
    (r'^noticia/listar/$', 'listar'),
    #(r'^noticia/(?P<noticia_id>\d)/$', 'obterPorId'),
    (r'^noticia/(?P<noticia_slug>[\w_-]+)$', 'obterPorSlug'),
    (r'^noticia/buscar/(?P<search>\w+)$', 'buscar'),
)

urlpatterns += patterns('contato.views',
    (r'^contato/$', 'principal'),
)

urlpatterns += patterns('downloads.views',
    (r'^downloads/$', 'listar'),
)

urlpatterns += patterns('page.views',
    (r'^pagina/(?P<page_nome>\w+)$', 'obterPorNome'),
)

urlpatterns += patterns('galeria.views',
    (r'^galeria/albuns/$', 'ListarAlbuns'),
    (r'^galeria/albuns/(?P<album_slug>[\w_-]+)$', 'obterPorSlug'),
)

urlpatterns += patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
)


#if settings.DEBUG:
#    urlpatterns += patterns('',
#        (r'^media/(?P<path>.*)$', 'django.views.static.serve',
#            {'document_root': settings.MEDIA_ROOT}),
#    )
